int g_OffsetX;
int g_OffsetY;
int g_Width;
int g_Height;
int g_ScreenWidth;
int g_ScreenHeight;

struct VS_INPUT
{
	float VertexID	: TEXCOORD0;
};

struct VS_OUTPUT
{
    float4 pos		: POSITION;
};

VS_OUTPUT RenderSceneVS( VS_INPUT In )
{
    VS_OUTPUT Out = ( VS_OUTPUT )0;
	int iVertexID = In.VertexID;
	if ( 0 == iVertexID )
	{
		Out.pos.x = 2.f * g_OffsetX / g_ScreenWidth - 1;
		Out.pos.y = 1 - 2.f * g_OffsetY / g_ScreenHeight;
	}
	else if ( 1 == iVertexID )
	{
		Out.pos.x = 2.f * ( g_OffsetX + g_Width ) / g_ScreenWidth - 1;
		Out.pos.y = 1 - 2.f * g_OffsetY / g_ScreenHeight;
	}
	else if ( 2 == iVertexID )
	{
		Out.pos.x = 2.f * g_OffsetX / g_ScreenWidth - 1;
		Out.pos.y = 1 - 2.f * ( g_OffsetY + g_Height ) / g_ScreenHeight;
	}
	else if ( 3 == iVertexID )
	{
		Out.pos.x = 2.f * ( g_OffsetX + g_Width ) / g_ScreenWidth - 1;
		Out.pos.y = 1 - 2.f * ( g_OffsetY + g_Height ) / g_ScreenHeight;
	}
    Out.pos  = float4( Out.pos.x, Out.pos.y, 0.0, 1.0 );
    return Out;
}

float4 RenderScenePS( VS_OUTPUT In ) : COLOR0
{
    return float4( 1.0 ,1.0 ,0.0 ,0.0 );
}

technique DefaultTech
{    
    pass P0
    {
        FillMode = WireFrame;
        VertexShader = compile vs_2_0 RenderSceneVS();
        PixelShader  = compile ps_2_0 RenderScenePS();
    }
}